package com.bonc.rms.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.bonc.rms.service.RegisterService;

@RestController
@RequestMapping(value = "/registerController")
public class RegisterController {
	
	    @Autowired
	    RegisterService registerService;
	    
	    /**
	     * 用户注册
	     */

	    @RequestMapping(value = "/register")
	    public ModelAndView login(@RequestParam(name = "userName", required = true) String userName,
	                              @RequestParam(name = "password", required = true) String password,
	                              @RequestParam(name = "sex", required = true) String sex,
	                              @RequestParam(name = "email", required = true) String email,
	                              @RequestParam(name = "address", required = true) String address,
	                              @RequestParam(name = "mobilePhone", required = true) String mobilePhone,
	                              HttpSession httpSession) {
			registerService.register(userName, password,sex,email,address,mobilePhone);
			ModelAndView modelAndView = new ModelAndView("login/user_login");
			return modelAndView;
	        
	    }


}
